package com.nursing.controller.nurse;

import com.nursing.bean.CareTask;
import com.nursing.model.Result;
import com.nursing.model.dto.TaskCompleteDto;
import com.nursing.service.TaskService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/nurseTask")
public class NurseTaskController {
    private final TaskService service;

    public NurseTaskController(TaskService service) {
        this.service = service;
    }

    @PostMapping("/finishTask")
    public Result<String> finishTask(@RequestBody TaskCompleteDto taskCompleteDto) {
        CareTask task = new CareTask();
        task.setId(taskCompleteDto.getTaskId());
        task.setTaskDetails(taskCompleteDto.getTaskDetail());

        service.finishTask(task);
        return Result.success("操作成功");
    }
}
